1. Field of the Invention
The present invention relates to a magnetic sensor for detecting a rotational speed or rotational angle of a motor and a motor having the magnetic sensor.
2. Description of the Related Art
Some of motors used in a machine tool or an industrial robot, etc., have a magnetic sensor incorporated therein to detect a rotational speed or a rotational angle thereof.
FIG. 8A is a perspective view showing the structure of a conventional magnetic sensor incorporated in a motor, and FIG. 8B is a view of the magnetic sensor as viewed from the direction indicated by the arrow A in FIG. 8A.
The conventional magnetic sensor 100 shown in FIG. 8A is composed of a sensor gear 102 attached to a rotor 101 of the motor, a detection portion 103 which detects signals indicating the presence or absence of a plurality of teeth 102 which are formed in series at predetermined distances on the outer periphery of the sensor gear 102, a sensor holder 104 which holds the detection portion 103, a sensor mounting base 105 to which the sensor holder 104 is attached, and mounting screws 106 by which the sensor holder 104 is attached to the sensor mounting base 105. In particular, as can be seen in FIG. 8B, when the sensor holder 104 is attached to the sensor mounting base 105, the detection portion 103 on the sensor holder 104 is opposed to the outer periphery of the sensor gear 102.
The detection portion 103 is provided with a Hall element 103a whose output voltage varies depending on a change in the magnetic field. The sensor gear 102 is made of a magnetic material, and accordingly, the magnetic field changes with respect to the Hall element 103a in accordance with the absence or presence of the teeth 102a of the sensor gear 102 opposed to the Hall element 103a. Therefore, when one of the plurality of teeth 102a of the sensor gear 102 is opposed to the Hall element 103a of the detection portion 103, the Hall element 103a of the detection portion 103 outputs a signal representing the presence of the tooth 102a, that is, a detection signal. Furthermore, the plurality of teeth 102a of the sensor gear 102 move across the front of the detection portion 103 during the rotation of the sensor gear 102 together with the rotation of the rotor 101, and therefore, the detection signals are periodically issued from the detection portion 103. Thus, the conventional magnetic sensor 100 detects the rotational speed of the rotor 101 based on the frequency of the detection signals of the teeth 102a. 
The detection signals outputted by the detection portion 103 become more intense as a distance between the sensor gear 102 and the detection portion 103 decreases, and conversely, the detection signals become less intense as the distance increases. Therefore, the distance between the sensor gear 102 and the detection portion 103 must be finely adjusted so that the detection portion 103 can judge the presence or absence of the teeth 102a of the sensor gear 102.
When the distance between the sensor gear 102 and the detection portion 103 is adjusted as mentioned above, conventionally, a skilled operator provisionally attaches the sensor holder 104 to the sensor mounting base 105 by screws, and thereafter, makes a fine adjustment of the distance by pushing or striking the detection portion 103. Furthermore, as a skilled operator makes an adjustment while viewing the waveform of the detection signals issued from the detection portion 103, it is necessary to continuously rotate the sensor gear 102 during the adjustment of the distance.
It is difficult to estimate the displacement of the detection portion 103 in the adjustment of the distance by pushing or striking the detection portion 103. Consequently, it takes a long time not only for an unskilled operator but also a skilled operator to make a distance adjustment. Moreover, even a skilled operator may bring the detection portion 103 into contact with the sensor gear 102 which is rotating, thus resulting in a breakage of the sensor gear 102 or the detection portion 103.
To prevent the detection portion 103 from being broken during the distance adjustment as mentioned above, Japanese Patent Application Laid-open No. 62-180215 has proposed a solution thereto. Namely, Japanese Patent Application Laid-open No. 62-180215 discloses a method for adjusting the distance between an object to be detected and a magnetic drum wherein an object base and an encoder base engage with each other through a distance adjustment screw which extends in the direction in which the object to be detected and the magnetic drum are spaced from one another, so that the distance between the object and the magnetic drum can be adjusted by moving the object base by the adjustment of the fastening degree of the distance adjustment screw.
However, in the adjustment method disclosed in Japanese Patent Application Laid-open No. 62-180215, the shaft for tilting the object to be detected is adjusted by an angle adjustment screw as well. After the completion of the adjustment of the distance between the object to be detected and the magnetic drum and the shaft for tilting the object to be detected, the distance adjustment screw and the angle adjustment screw are secured by an adhesive. Therefore, it is necessary not only to adjust the distance between the object to be detected and the magnetic drum and the shaft for tilting the object to be detected by the respective screws but also to use an adhesive. As a result, the distance adjustment may require a long time to complete.